<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    /* 1.在页面弹框输入你的工资
    1)计算出每月需要扣的社保额度
    2)计算出每月需要纳税多少钱
    3)得出应发工资多少钱 */

    var wage = prompt('请输入你的工资：');
        // wage =parseFloat(wage);
    var social_security = wage * 0.23;
    var residue = wage - social_security;
    var individual_income_tax;
    if (wage <= 5000) {
        individual_income_tax = 0;
        document.write('你需要缴纳社保：' + social_security + '元' + '<br>');
        document.write('你需要缴纳个人所得税：' + individual_income_tax + '元');
    }
    else if (wage <= 8000 && wage > 5000) {
        individual_income_tax = residue * 0.03;
        document.write('你需要缴纳社保：' + social_security + '元' + '<br>');
        document.write('你需要缴纳个人所得税：' + individual_income_tax + '元');
    }
    else if (wage <= 17000 && wage > 8000) {
        individual_income_tax = residue * 0.1;
        document.write('你需要缴纳社保：' + social_security + '元' + '<br>');
        document.write('你需要缴纳个人所得税：' + individual_income_tax + '元');
    }
    else if (wage <= 30000 && wage > 17000) {
        individual_income_tax = residue * 0.2;
        document.write('你需要缴纳社保：' + social_security + '元' + '<br>');
        document.write('你需要缴纳个人所得税：' + individual_income_tax + '元');
    }
    else if (wage <= 40000 && wage > 30000) {
        individual_income_tax = residue * 0.25;
        document.write('你需要缴纳社保：' + social_security + '元' + '<br>');
        document.write('你需要缴纳个人所得税：' + individual_income_tax + '元');
    }
    else if (wage <= 60000 && wage > 40000) {
        individual_income_tax = residue * 0.3;
        document.write('你需要缴纳社保：' + social_security + '元' + '<br>');
        document.write('你需要缴纳个人所得税：' + individual_income_tax + '元');
    }
    else if (wage <= 85000 && wage > 60000) {
        individual_income_tax = residue * 0.35;
        document.write('你需要缴纳社保：' + social_security + '元' + '<br>');
        document.write('你需要缴纳个人所得税：' + individual_income_tax + '元');
    }
    else if (wage > 85000) {
        individual_income_tax = residue * 0.45;
        document.write('你需要缴纳社保：' + social_security + '元' + '<br>');
        document.write('你需要缴纳个人所得税：' + individual_income_tax + '元');
    }
    else {
        document.write(typeof(wage));
        // do {
        //     var wage = prompt('请正确输入你的工资：');
        //     var social_security = wage * 0.23;
        //     var residue = wage - social_security;
        //     var individual_income_tax;
        //     if (wage <= 5000) {
        //         individual_income_tax = 0;
        //         document.write('你需要缴纳社保：' + social_security + '元' + '<br>');
        //         document.write('你需要缴纳个人所得税：' + individual_income_tax + '元');
        //     }
        //     else if (wage <= 8000 && wage > 5000) {
        //         individual_income_tax = residue * 0.03;
        //         document.write('你需要缴纳社保：' + social_security + '元' + '<br>');
        //         document.write('你需要缴纳个人所得税：' + individual_income_tax + '元');
        //     }
        //     else if (wage <= 17000 && wage > 8000) {
        //         individual_income_tax = residue * 0.1;
        //         document.write('你需要缴纳社保：' + social_security + '元' + '<br>');
        //         document.write('你需要缴纳个人所得税：' + individual_income_tax + '元');
        //     }
        //     else if (wage <= 30000 && wage > 17000) {
        //         individual_income_tax = residue * 0.2;
        //         document.write('你需要缴纳社保：' + social_security + '元' + '<br>');
        //         document.write('你需要缴纳个人所得税：' + individual_income_tax + '元');
        //     }
        //     else if (wage <= 40000 && wage > 30000) {
        //         individual_income_tax = residue * 0.25;
        //         document.write('你需要缴纳社保：' + social_security + '元' + '<br>');
        //         document.write('你需要缴纳个人所得税：' + individual_income_tax + '元');
        //     }
        //     else if (wage <= 60000 && wage > 40000) {
        //         individual_income_tax = residue * 0.3;
        //         document.write('你需要缴纳社保：' + social_security + '元' + '<br>');
        //         document.write('你需要缴纳个人所得税：' + individual_income_tax + '元');
        //     }
        //     else if (wage <= 85000 && wage > 60000) {
        //         individual_income_tax = residue * 0.35;
        //         document.write('你需要缴纳社保：' + social_security + '元' + '<br>');
        //         document.write('你需要缴纳个人所得税：' + individual_income_tax + '元');
        //     }
        //     else if (wage > 85000) {
        //         individual_income_tax = residue * 0.45;
        //         document.write('你需要缴纳社保：' + social_security + '元' + '<br>');
        //         document.write('你需要缴纳个人所得税：' + individual_income_tax + '元');
        //     }
        // } while (typeof (wage) != 'number');
    }
    // while (typeof (wage) != 'number') {
        
    // }
</script>

</html>